var express = require('express')
var router = express.Router();
var getParam = require('querystring')

// 举报列表
router.get('/post/query/reportList.html',function(req,res,next){
    var url = req.url.split('?')[1];
    var param = getParam.parse(url);
    console.log(param);
    if (param.poiId) {
        res.jsonp(
        {
            "resultCode": 0, //0为成功
            "resultMsg":"成功", //错误信息
            "result":[
            {
                "content": "秒举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2016-10-31 11:56:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            },
            {
                "content": "分钟举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2016-10-31 11:50:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            },
            {
                "content": "小时举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2016-10-31 07:10:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            },
            {
                "content": "天举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2016-10-28 10:10:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            },
            {
                "content": "月举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2016-06-28 10:10:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            },
            {
                "content": "年举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": "图片集合", //图片集合,
                "publishTime": "2015-05-28 10:10:10", //发布时间,
                "dealCount": 3, //处理次数
                "relationId": 1, //关联id
                "relationType": 0, //关联类型 0：帖子 1：评论
                "reportCount": 7 //被举报次数
            }
        ]}
        )
    }else{
        res.jsonp(
            {
            "resultCode": 1, //0为成功
            "resultMsg":"获取失败", //错误信息
            }
        )
    };
})
// 处理列表
router.get('/post/query/dealList.html',function(req,res,next){
    var url = req.url.split('?')[1];
    var param = getParam.parse(url);
    console.log(param);
    if (param.poiId) {
        res.jsonp(
        {
            "resultCode": 0, //0为成功
            "resultMsg":"成功", //错误信息
            "result": [
                {
                    "content": "举报的帖子标题",  //内容
                    "custName": "长江", //会员名
                    "custNo": "123456", //会员编号,
                    "custImage": "http://xxxx", //会员头像,
                    "images": "图片集合", //图片集合,
                    "publishTime": "2016-8-28 10:10:10", //发布时间,
                    "dealCount": 3, 
                    "relationId": 1,
                    "relationType": 0,
                    "reportCount": 7,
                    "dealStatus": 5,
                    "forbiddenDays": 22
                },
                {
                    "content": "举报的帖子标题",  //内容
                    "custName": "长江", //会员名
                    "custNo": "123456", //会员编号,
                    "custImage": "http://xxxx", //会员头像,
                    "images": "图片集合", //图片集合,
                    "publishTime": "2015-10-28 10:10:10", //发布时间,
                    "dealCount": 3, 
                    "relationId": 1,
                    "relationType": 0,
                    "reportCount": 7,
                    "dealStatus": 3,
                    "forbiddenDays": 22
                }
            ]}
        )
    }else{
        res.jsonp(
            {
            "resultCode": 1, //0为成功
            "resultMsg":"获取失败", //错误信息
            }
        )
    };
})
// 举报详情
router.get('/post/query/reportHistory.html',function(req,res,next){
    var url = req.url.split('?')[1];
    var param = getParam.parse(url);
    console.log(param);
    if (param.relationId) {
        res.jsonp(
        {
            "resultCode": 0, //0为成功
            "resultMsg":"成功", //错误信息
            "result":{
                "content": "举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": [
                    "http://xxxx", 
                    "http://xxxx"
                ], //图片集合,
                "publishTime": "2016-10-12 10:10:10", //发布时间,
                "historys": [
                    {
                        "byCustName": "长江啊"+param.relationId, //举报人
                        "byCustNo": "123456", //举报会员编号
                        "reportTime": "2016-10-12 10:10:10", //举报时间
                        "reportType": 0, //举报理由
                    },
                    {
                        "byCustName": "长江长江啊"+param.relationId, //举报人
                        "byCustNo": "123456", //举报会员编号
                        "reportTime": "2017-10-12 10:10:10", //举报时间
                        "reportType": 1, //举报理由
                    }

                ]
            }
        })
    }else{
        res.jsonp(
            {
            "resultCode": 1, //0为成功
            "resultMsg":"获取失败", //错误信息
            }
        )
    };
})
// 处理详情
router.get('/post/query/dealHistory.html',function(req,res,next){
    var url = req.url.split('?')[1];
    var param = getParam.parse(url);
    console.log(param);
    if (param.relationId) {
        res.jsonp(
        {
            "resultCode": 0, //0为成功
            "resultMsg":"成功", //错误信息
            "result": {
                "content": "举报的帖子标题",  //内容
                "custName": "长江", //会员名
                "custNo": "123456", //会员编号,
                "custImage": "http://xxxx", //会员头像,
                "images": [
                    "http://xxxx", 
                    "http://xxxx"
                ], //图片集合,
                "publishTime": "2016-10-12 10:10:10", //发布时间,
                "historys": [
                    {
                        "dealCustName": "黄河"+param.relationId, //处理人名
                        "dealCustNo": "123456", //处理会员编号
                        "dealStatus": 1, //处理状态
                        "dealTime": "2016-10-12 10:10:10", //处理时间
                        "forbiddenDays": 30 //禁言天数
                    },
                    {
                        "dealCustName": "黄河"+param.relationId, //处理人名
                        "dealCustNo": "123456", //处理会员编号
                        "dealStatus": 3, //处理状态
                        "dealTime": "2017-10-12 10:10:10", //处理时间
                        "forbiddenDays": 13 //禁言天数
                    }
                ]
            }
        })
    }else{
        res.jsonp(
            {
            "resultCode": 1, //0为成功
            "resultMsg":"获取失败", //错误信息
            }
        )
    };
})
// 处理
router.get('/post/reportDeal.do',function(req,res,next){
    var url = req.url.split('?')[1];
    var param = getParam.parse(url);
    console.log(param);
    if (param.reportId) {
        res.jsonp(
        {
            "resultCode": 0, //0为成功
            "resultMsg":"成功" //错误信息
        }
        )
    }else{
        res.jsonp(
            {
            "resultCode": 1, //0为成功
            "resultMsg":"获取失败", //错误信息
            }
        )
    };
})

module.exports = router


